﻿<script>
    $(function () {
        var $linkPage = $('#LinkPage');
        var $routeValueFields_Editor = $('#RouteValueFields_Editor');

        $linkPage.change(function () {
            $.ajax('@Html.Raw(Url.Action("GetPageRouteFields", ViewContext.RequestContext.AllRouteValues()))', {
                data: { pageName: $(this).val() },
                type: 'POST'
            }).done(function (data) {
                var model = $routeValueFields_Editor.data("KO_ViewModel");
                model.data.removeAll();
                _.each(data.Model, function (item) {                    
                    model.data.push(item);
                });
            });
        });
    });
</script>
